package com.shihb.principle.inversion.newdemo;

/**
 *Description:依赖倒置改进
 *Version:1.0.0
 *@author shihb
 *@date 2020/6/28 20:20
 */
public class Demo {

  public static void main(String[] args) {


    new Person().receive(new Email());
    new Person().receive(new Weixin());
  }
}
class Email implements IReceiver{

  @Override
  public String getInfo() {
    return "电子邮件信息:hello world";
  }
}

class Weixin implements IReceiver{

  @Override
  public String getInfo() {
    return "微信信息:hello world";
  }
}
class Person{
  public void receive(IReceiver e){
    System.out.println(e.getInfo());
  }
}
